$(document).ready( function() {

	$("#taskEndDate").datepicker({
		'dateFormat': 'yy-mm-dd'
	});
	
	$(".progress").change( function() {
		var intProgress = $(this). val();
		var intTaskId = $(this).attr('task_id');
		var objUrl = $(this).parents(".project:first").find( ".deleteSchedule:first" ).attr("href").split("deleteTask");
		
		$.post( objUrl[0] + 'setTaskProgress/' + intTaskId + '/' + intProgress );
	});
	
	$("table").visualize({
		'width' : 450
	});
});

$("#showAddDialog").live( "click", function() {
	$("#addProjectDialog").dialog({
		width: 'auto',
		height: 'auto'
	});
});

$("#showAddCategoryDialog").live( "click", function() {
	$("#addCategoryDialog").dialog({
		width: 'auto',
		height: 'auto'
	});
});

$("#showAddTaskDialog").live( "click", function() {
	$("#addTaskDialog").dialog({
		width: 'auto',
		height: 'auto'
	});
});
